import java.util.Scanner;
import java.util.Arrays;
public class Question1 {
    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        boolean isCorrectMonth = false;
        boolean isCorrectDate = false;

        //输入年份
        System.out.println("请输入年份：");
        int year = in.nextInt();
        in.nextLine();

        // 输入并检查月份准确性
        int month = 0;
        while(!isCorrectMonth) {
            System.out.println("请输入月份：");
            isCorrectMonth = false;
            month = in.nextInt();
            in.nextLine();
            if (month > 0 && month < 13) {
                isCorrectMonth = true;
            }
        }
        // 输入并检查日期准确性
        int day = 0;
        int[] runYue = {1,3,5,7,8,10,12};
        while(!isCorrectDate){
            System.out.println("请输入日期：");
            isCorrectDate = false;
            day = in.nextInt();
            in.nextLine();
            // 如果为2月
            if (month == 2){
                if  (year % 400 == 0 || year % 4 == 0 && year % 100 != 0)
                    if(day <= 29 && day >= 1) isCorrectDate = true;
                    else
                    if(day <= 28 && day >= 1) isCorrectDate = true;
            } // 如果为闰月
            else if (Arrays.binarySearch(runYue, month) > 0){
                if (day <= 31 && day >= 1) isCorrectDate = true;
            }// 如果为其他月
            else{
                if (day <= 30 && day >= 1) isCorrectDate = true;
            }
        }
        // 结束读取
        in.close();

        int count = 0;
        // 將月份转换为天数
        switch (month - 1) {
            case 11:
                count += 30;
            case 10:
                count += 31;
            case 9:
                count += 30;
            case 8:
                count += 31;
            case 7:
                count += 31;
            case 6:
                count += 30;
            case 5:
                count += 31;
            case 4:
                count += 30;
            case 3:
                count += 31;
            case 2:
                if (year % 400 == 0 || year % 4 == 0 && year % 100 != 0) {
                    count += 29;
                } else
                    count += 28;
                ;
            case 1:
                count += 31;
        }
        count += day;
        System.out.println(year +"-"+month+"-"+day+"是该年中的第"+count+"天。");
        in.close();
    }
}
